package social_network.dao;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created with IntelliJ IDEA.
 * User: Vitaliy Muzalevskiy
 * Date: 13.07.13
 * Time: 16:22
 */
public interface ConnectionFactory {

    /**
     * Create new <code> Connection </code> to DataBase.
     *
     * @return new <code> Connection </code>.
     * @throws SQLException
     */
    Connection newConnection() throws SQLException;

    /**
     * This method need to be override if we use Connection Pool. If we don't,
     * it can just throw UnsupportedOperationException.
     *
     * @throws SQLException
     */
    void close() throws SQLException;
}
